<extend name="Public:innerbase" />
<block name="css">
<link rel="stylesheet" href="{:STATICS}/validation/css/validationEngine.jquery.css">
</block>
<block name="js">
<include file="Public:upload" />
<include file="Public:editor" />
<script type="text/javascript" src="{:STATICS}/validation/js/jquery.validationEngine.js"></script>
<script type="text/javascript" src="{:STATICS}/validation/js/jquery.validationEngine-zh_CN.js"></script>
<script>
function showChildCats(value){
	$("#catid").html('<option value="0">请选择...</option>');
	if(value==0){
		document.getElementById('catid').disabled=true;
	}else{
		$.ajax({
			url: $('#catUrl').attr("value")+'&parentid='+value,
			success: function( data ) {
				document.getElementById('catid').disabled=false;
				$("#catid").html($("#catid").html()+data);
			}
		});
	}
}

function toDecimal(x) {  
	var f = parseFloat(x);  
	if (isNaN(f)) {  
		return;  
	}  
	f = Math.round(x*10)/10;  
	return f;  
}

function calDiscount(){
	var price=$('#price').attr('value');
	var oprice=$('#oprice').attr('value');
	if(oprice!=0&&oprice!=''){
		var dis=oprice-price;
		var discount=10-toDecimal((dis/oprice)*10);
	}else{
		discount=10;
	}
	$('#discount').attr('value',discount);
}
$(function(){
	$("#editForm").validationEngine("attach",{ 
		promptPosition:"centerRight",
		scroll:true,
		showOneMessage:true
	});
});
</script>
</block>
<block name="content">
    <style>
        .form-group {
            clear: both;
        }
    </style>
<div class="container-fluid">
    <form method="post">
        <input type="hidden" name="id" value="{$_GET['id']}">
    <div class="form-group">
        <label class="col-sm-2">库存数量</label>
        <div class="col-md-2">
            <input type="text" id="stock" name="stock" value="{$stock}" class="form-control validate[required,custom[integer],min[0]]" />
            <span class="help-block">设置分店的库存数量</span>
        </div>
    </div>
		<div class="form-group">
			<div class="col-md-5 col-sm-offset-2">
				<input type="submit" class="btn btn-primary" value="保存" />
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <a class="btn btn-primary" href="/User/Dining/index2.html">返回</a>
			</div>
		</div>
	</form>
    <script>
        $("#editForm").submit(function(e){
            if($(".d_sec>span").length==0){
                alert("请添加版块");
                $("#sectionId").focus();
                return false;
            }
            return true;
        });
    </script>
</div>
</block>